Adds fill after s until it is width characters long, so columns line up: string_pad_right("hp", 5, ".") is "hp...". Only the first character of fill is used. Text that is already long enough comes back as it was.
string_pad_right(s, width, fill) -> string| Name | Type |
|---|---|
s | string |
width | int |
fill | string |
string
Adds fill after s until the text is width characters long, so columns line up. It is string_pad_left with the padding on the other side.
var label = string_pad_right("hp", 5, ".");label is "hp...".
fill is used, and an empty fill pads with spaces.width characters or longer comes back as it was."." is "...".One pass over the text, at most as long as a string can be.
The same rules as string_pad_left, with the padding on the other side: the result is cut off at the end if it would not fit in a string, an empty fill pads with spaces, and text already width long is not changed.